package com.example.demo.Controller;

import com.example.demo.Service.IAccountService;
import com.example.demo.entity.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CeshiController {
    @Autowired
    private IAccountService accountService;

    @GetMapping("/getStr")
    public String getstr(){
        System.out.println("进入后端方法");
        return "I'm here";
    }

    @GetMapping("/getadd")
    public int insert(Account account){
        System.out.println("进入添加模块");
        return accountService.add(account);
    }

    @GetMapping("/getName")
    public List<Account> getName(String name){
        System.out.println("进入查询名字模块");
        return accountService.getName(name);
    }

    @GetMapping("/getall")
    public List<Account> getAll(){
        System.out.println("进入查询所有数据模块");
        return accountService.getAll();
    }


}
